﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lottery.MediaData.Core {
    public class BatchDataItem {
        private List<TOZ> toz;

        public BatchDataItem() {
            toz = new List<TOZ>();
            for (int i = 0; i < 14; i++) {
                toz.Add(new TOZ());
            }
        }

        /// <summary>
        /// 序号
        /// </summary>
        public string Order { get; set; }

        public int Count { get { return toz.Count; } }

        public TOZ this[int index] {
            get {
                return toz[index];
            }
        }

        public override string ToString() {
            var sb = new StringBuilder();
            sb.Append(Order).Append(":");
            for (int i = 0; i < 14; i++) {
                sb.Append(toz[i].Three).Append(",");
                sb.Append(toz[i].One).Append(",");
                sb.Append(toz[i].Zero).Append(" ");
            }
            return sb.ToString();
        }

        public BatchDataItemT2 ToT2() {
            var result = new BatchDataItemT2();
            result.Order = this.Order;
            for (int i = 0; i < result.Count; i++) {
                var item = this[i];

                var resultItem = result[i];
                resultItem.Three = Convert.ToInt32(item.Three);
                resultItem.One = Convert.ToInt32(item.One);
                resultItem.Zero = Convert.ToInt32(item.Zero);
                resultItem.CalcDZX();
            }
            return result;
        }
    }
}
